unit ai_johnsen;

{
  An AI wich just clicks around until its no longer its turn
}

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, basicAI, basicio_City, basicio_street, basicio_field,
  basicio_resources, basicio_const, io_imagecapture_const;

type

  { TAI_johnsen }
  TAI_Johnsen = class (TBasicAI)
  protected
    function ReturnCity: TCityPosition; override;
    function ReturnStreet: TStreetPosition; override;
    function ReturnThiefField: TFieldPosition; override;
    function ReturnThiefCity: TCityPosition; override;
    function ReturnThrowRes(AAmount: integer): TResources; override;
    procedure HandleBuilding; override;
  end;

implementation

uses
  SystemManager;

function TAI_Johnsen.ReturnCity: TCityPosition;
var
  i: integer;
begin
  i := random(high(CityPosArray));
  result.x := CityPosArray[i].CityX;
  result.y := CityPosArray[i].CityY;
end;

function TAI_Johnsen.ReturnStreet: TStreetPosition;
begin
  result := StreetPosArray[random(high(StreetPosArray))];
end;

function TAI_Johnsen.ReturnThiefField: TFieldPosition;
begin
  result := GlobalSystemManager.IO.Data.Map.FieldsByID[random(GlobalSystemManager.IO.Data.Map.FieldCount-1)].position;
end;

function TAI_Johnsen.ReturnThiefCity: TCityPosition;
begin
  result := GlobalSystemManager.IO.Data.Map.CityByID[random(GlobalSystemManager.IO.Data.Map.CityCount-1)].Position;
end;

function TAI_Johnsen.ReturnThrowRes(AAmount: integer): TResources;
begin
  result := Resources(random(5),random(5),random(5),random(5),random(5));
end;

procedure TAI_Johnsen.HandleBuilding;
begin
  //nothing to build!
end;

{ TAI_johnsen }

initialization
  GlobalSystemManager.RegisterAISystem(TAI_Johnsen);

end.


